<%@ page language="java" pageEncoding="UTF-8" %>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<script type="text/javascript">
    function rollback() {
        window.location.href = "${pageContext.request.contextPath}/index.jsp";
    }

    function loginUser() {
        var username = $("#username");
        var password = $("#password");
        var msg = "";
        if ($.trim(username.val()) == "") {
            alert("登录名不能为空");
            msg = "登录名不能为空";
            username.focus();//获取焦点
        } else if ($.trim(password.val()) == "") {
            alert("密码不能为空");
            msg = "密码不能为空";
            password.focus();
        }
        if (msg != "") {
            return false;
        }
        $.post("${pageContext.request.contextPath}/admin/user/yLoginuser", $("#form1").serialize(),
            function (data) {
                if (data == "OK") {
                    window.location.href = "${pageContext.request.contextPath}/admin/login/home.jsp";
                } else {
                    alert("抱歉，你输入的账号不是管理员账号，请重新输入");
                    window.location.reload();
                }
            })
    }

    function ini() {
        document.form1.logonName.focus();
    }
</script>

<html>
<head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <link href="${pageContext.request.contextPath}/admin/css/Style.css" rel="stylesheet" type="text/css">
</head>

<body onload="ini()">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td align="center">
            <table width="452" height="290" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td bgcolor="#FFFFFF">
                        <table width="452" height="290" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td height="74">
                                    <img src="${pageContext.request.contextPath}/admin/images/logintitle.gif">
                                </td>
                            </tr>
                            <tr>
                                <td align="center" valign="bottom"
                                    background="${pageContext.request.contextPath}/admin/images/loginbg.gif">
                                    <form id="form1" name="form1" action="" target="_parent" method="post">
                                        <table border="0" align="center" cellpadding="2" cellspacing="0">
                                            <tr align="center">
                                                <td height="30" colspan="2" style="border-bottom: 1px dotted #cccccc">
                                                    <strong style="font-size: 14px;">请登录</strong>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" nowrap>
                                                    <font color="000F60"><strong>用户名：</strong> </font>
                                                </td>
                                                <td>
                                                    <input type="text" name="username" id="username"
                                                           class="text" style="width: 160px;"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" nowrap>
                                                    <strong><font color="000F60">密码： </font> </strong>
                                                </td>
                                                <td>
                                                    <input type="password" name="password" id="password" class="text"
                                                           style="width: 160px;"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="15" nowrap colspan="2">
                                                    <strong><font color="red"></font> </strong>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30">
                                                </td>
                                                <td>
                                                    <input type="button" onclick="loginUser()"
                                                           value="&#30331;&#24405;" class="buttoninput"/>

                                                    <input type="reset" value="&#21462;&#28040;"
                                                           class="buttoninput"/>
                                                    <input type="button" onclick="rollback()" value="返回首页"/>

                                                </td>
                                            </tr>
                                        </table>
                                    </form>


                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td height="30" align="center">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="23" align="center"></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>

                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>

